package cn.player.adapter;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.List;

import cn.player.R;
import cntv.player.core.util.Utils;
import cn.player.media.adapter.BaseAdpt;
import cn.player.media.entity.VodListInfo;

public class RightSelectInfoAdapter extends BaseAdpt<VodListInfo> {

    private int currentOrder;

    public RightSelectInfoAdapter(Context mContext, List<VodListInfo> mData,
                                  int layoutResource) {
        super(mContext, mData, layoutResource);
        // TODO Auto-generated constructor stub
    }


    public void setCurrentOrder(int currentOrder) {
        this.currentOrder = currentOrder;
    }


    @Override
    protected void addViewId() {
        // TODO Auto-generated method stub
        mViewIds.add(R.id.ll_right_select);
        mViewIds.add(R.id.tv_current_position);
        mViewIds.add(R.id.tv_right_select_title);
    }

    @Override
    protected void updateItemViews(int position) {
        // TODO Auto-generated method stub
        LinearLayout ll_select = (LinearLayout) viewHolder.getView(R.id.ll_right_select);
        TextView tv_current = (TextView) viewHolder.getView(R.id.tv_current_position);
        TextView tv_select_title = (TextView) viewHolder.getView(R.id.tv_right_select_title);
        if (currentOrder == Utils.strToInt(mData.get(position).getOrder())) {
//			ll_select.setBackgroundColor(mContext.getResources().getColor(R.color.item_selected));
            tv_current.setVisibility(View.VISIBLE);
        } else {
//			ll_select.setBackgroundColor(mContext.getResources().getColor(R.color.half_transparent));
            tv_current.setVisibility(View.GONE);
        }
        tv_select_title.setText(mData.get(position).getT());
    }

}
